/**
 * 
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 *   
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 * 
 */
package org.jiopi.ibean.example.module.helloworld;

import org.jiopi.ibean.example.blueprint.helloworld.IBean;

/**
 * 
 * IBean工厂类
 * 
 * 用于创建各种 IBean
 * 
 *
 * @version 0.1 2010.4.27
 * @since iBean0.1 2010.4.27
 */
public class IBeanFactory {
	
	/**
	 * 默认工厂iBean
	 * @return
	 */
	public static IBean getDefaultFactoryIBean(){
		IBeanImpl newIBeanImpl = new IBeanImpl();
		newIBeanImpl.msg = "Default Factory IBean";
		return newIBeanImpl;
	}
	
	/**
	 * 自定义iBean
	 * @param msg 你的留言
	 * @return
	 */
	public static IBean getYourIBean(String msg){
		IBeanImpl newIBeanImpl = new IBeanImpl();
		newIBeanImpl.msg = msg;
		return newIBeanImpl;
	}
	
	/**
	 * 
	 * 唠叨的iBean
	 * 
	 * @param msg 你的信息
	 * @param num 打印的次数,最大值10
	 * @return
	 */
	public static IBean getGabberIBean(String msg,int num){
		IBeanImpl newIBeanImpl = new IBeanImpl();
		newIBeanImpl.msg = msg;
		if(num>10)num=10;
		for(int i=1;i<num;i++){
			newIBeanImpl.msg += "\n"+msg;
		}
		return newIBeanImpl;
	}
	
}
